<?php

class Ehl_Model_Abstract extends Jnd_Model_Abstract
{

    public function getId()
    {
        return $this->id;
    }

    public function setId( $id )
    {
        $this->id = $id;
    }

    public function _transformRowsCallback( &$row, $view )
    {}

    public function setCreationUser( $user = __CLASS__ )
    {
        if ($this->getCreationUser() == "") {
            $this->creationUser = $user;
        }
    }

    public function setCreationDate( $date = null )
    {
        if (is_null($date)) {
            $date = date(Jnd_Global_Constantes::FORMAT_DATE_WEB_LONG);
        }
        $this->creationDate = $date;
    }

    public function listerPourSelect( $champ, $blanc = false )
    {
        $liste = array();
        $listeObjet= $this->_getMapper()->listerPourSelect();
        if ($blanc) {
            $liste[''] = '?';
        }
		$methodeGet = "get" . ucfirst($champ);
        foreach ($listeObjet as $objet) {
            $liste[$objet->getId()] = trim($objet->$methodeGet());
        }
        return $liste;
    }
}

